/*
 * Copyright (c) 2025 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef HMSERIALIZATION_JSON_UTILS_H
#define HMSERIALIZATION_JSON_UTILS_H

#include "napi/native_api.h"

namespace json_utils {
/**
 * Deserialize a JSON string into an ESObject object.
 * @param env
 * @param info
 * @return
 */
napi_value Parse(napi_env env, napi_callback_info info);

/**
 * Incrementally parse JSON data from an ArrayBuffer into an ESObject object.
 * @param enc
 * @param info
 * @return
 */
napi_value ParseInc(napi_env enc, napi_callback_info info);

/**
 * Asynchronous operation: incrementally parse JSON data from an ArrayBuffer into an ESObject object.
 * @param enc
 * @param info
 * @return
 */
napi_value ParseIncAsync(napi_env enc, napi_callback_info info);

/**
 * Serialize an ESObject object into a JSON string.
 * @param env
 * @param info
 * @return
 */
napi_value Stringify(napi_env env, napi_callback_info info);

/**
 * Serialize an ESObject object into an ArrayBuffer.
 * @param env
 * @param info
 * @return
 */
napi_value StringifyToBuffer(napi_env env, napi_callback_info info);

/**
 * Deserialize a JSON string into an ESObject object with options.
 * @param env
 * @param info
 * @return
 */
napi_value ParseWithOptions(napi_env env, napi_callback_info info);

/**
 * Incrementally parse JSON data from an ArrayBuffer into an ESObject object with options.
 * @param enc
 * @param info
 * @return
 */
napi_value ParseIncWithOptions(napi_env enc, napi_callback_info info);

/**
 * Asynchronous operation: incrementally parse JSON data from an ArrayBuffer into an ESObject object with options.
 * @param enc
 * @param info
 * @return
 */
napi_value ParseIncAsyncWithOptions(napi_env enc, napi_callback_info info);

/**
 * Serialize an ESObject object into a JSON string with options.
 * @param env
 * @param info
 * @return
 */
napi_value StringifyWithOptions(napi_env env, napi_callback_info info);

/**
 * Serialize an ESObject object into an ArrayBuffer with options.
 * @param env
 * @param info
 * @return
 */
napi_value StringifyToBufferWithOptions(napi_env env, napi_callback_info info);
}

#endif // HMSERIALIZATION_JSON_UTILS_H
